package com.tengfei.blogsystem;

import com.tengfei.blogsystem.utils.SnowFlakeIdWorker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @version v1.0
 * @author} feige
 * @date 2021-10-13-17:27
 * @description
 */
@EnableSwagger2
@SpringBootApplication
public class BlogSystemApplication {
    public static void main(String[] args) {
        SpringApplication.run(BlogSystemApplication.class, args);
    }

    /**
     * 雪花算法
     */
    @Bean
    public SnowFlakeIdWorker createIdWorker() {
        return new SnowFlakeIdWorker(0, 0);
    }

    /**
     * Spring-Security加密
     */
    @Bean
    public BCryptPasswordEncoder createPasswordEncode() {
        return new BCryptPasswordEncoder();
    }
}
